package utils

import (
	"log"

	"github.com/spf13/viper"
)

func ConfigInit() {
	viper.SetConfigFile("./config/conf.yaml")
	if err := viper.ReadInConfig(); err != nil {
		log.Fatalln("读取配置文件错误！" + err.Error())
	}
	Mysqldns = viper.GetString("mysql.root") + ":" +
		viper.GetString("mysql.passwd") +
		"@tcp(" + viper.GetString("mysql.addr") +
		")/" + viper.GetString("mysql.databases") +
		viper.GetString("mysql.default")
   ServePort=viper.GetString("serve.port")
   Redisaddr = viper.GetString("redis.addr")
	Redispasswd = viper.GetString("redis.passwd")
	RedisDB = viper.GetInt("redis.DB")
}
var (
	Mysqldns string //mysql连接数据
	ServePort string //启动端口
	Redisaddr      string //redisIP
	Redispasswd    string //redis密码
	RedisDB        int    //redis数据库分区
)
